package week6;

import java.io.File;

/**
 * @author The Setting sun
 * @create 2021-10-14 14:28
 */
public class Work1 {
    public static void main(String[] args) {
        File file = new File("D:\\");
        showFile(file);
    }

    public static void showFile(File file){
        File[] files = file.listFiles();

        for (int i = 0; i < files.length; i++) {
            if (files[i].isFile() && files[i].getName().endsWith(".txt")){
                System.out.println(files[i].getName());
            }else if(files[i].isDirectory()){
                showFile(files[i]);
            }
        }
    }
}
